﻿#pragma once

#include <QDialog>
#include "ui_SetTurnTableAndThermostatDialog.h"

#include "QValidator.h"


#include "ACT/TurnTable/TurnTableCodec.h"
#include "ObjAutoInject.h"
class TurnTableRunningStateManager;
class SerialPortManager;
class GroupBox_SetSerialPort;

class SetTurnTableAndThermostatDialog : public QDialog,public ObjAutoInject
{
	Q_OBJECT

private:
	Ui::SetTurnTableAndThermostatDialog ui;

	TurnTableCodec* turnTableCodec = Q_NULLPTR;
	TurnTableRunningStateManager* turnTableRunningStateManager = Q_NULLPTR;
	SerialPortManager* serialPortManager = Q_NULLPTR;
public:
	explicit SetTurnTableAndThermostatDialog(QWidget* parent = Q_NULLPTR);
	virtual ~SetTurnTableAndThermostatDialog();
public:
	int exec();
public slots:
	void accept();
	void reject();
private:
	void showTurnTableInfo();
public:
	TurnTableCodec::TurnTableLoadMode getLoadMode();
	TurnTableCodec::TurnTableRunningMode getRunningMode();
	float getPosition();
	float getRate();
	float getAcceleration();
	float getTargetTemperature();
	float getTemperatureRate();

private slots:
	void slot_updatePositionMode();
	void slot_updateRateMode();
	void slot_updateTemperature();
public:
	int getAccuracy();
	void setAccuracy(int accuracy);
	int getTurnTable_positionUpperLimit();
	void setTurnTable_positionUpperLimit(int turnTable_positionUpperLimit);
	int getTurnTable_positionLowerLimit();
	void setTurnTable_positionLowerLimit(int turnTable_positionLowerLimit);
	int getTurnTable_rateUpperLimit();
	void setTurnTable_rateUpperLimit(int turnTable_rateUpperLimit);
	int getTurnTable_rateLowerLimit();
	void setTurnTable_rateLowerLimit(int turnTable_rateLowerLimit);
	int getTurnTable_accelerationUpperLimit();
	void setTurnTable_accelerationUpperLimit(int turnTable_accelerationUpperLimit);
	int getTurnTable_accelerationLowerLimit();
	void setTurnTable_accelerationLowerLimit(int turnTable_accelerationLowerLimit);
public:
	TurnTableCodec* getTurnTableCodec();
	void setTurnTableCodec(TurnTableCodec* turnTableCodec);
	TurnTableRunningStateManager* getTurnTableRunningStateManager();
	void setTurnTableRunningStateManager(TurnTableRunningStateManager* turnTableRunningStateManager);
	SerialPortManager* getSerialPortManager();
	void setSerialPortManager(SerialPortManager* serialPortManager);

public:
	virtual void objectAutoInjection(QHash<QString, QObject*>* objMap)override;
};
